'''
desc:
        更改某一列的值统一加上一个固定值
author: fuml

date:2019-11-08
'''

import os
import sys
import re

src_file=r'C:\Users\fumengli\Desktop\ch3.sql'
dst_file=r'C:\Users\fumengli\Desktop\ch3_mod.sql'
with open (src_file,'r') as f_read, open (dst_file ,'w')as f_write:
    for line in f_read:
        #print(line)
        wordlist= re.split(' ',line)
        #wordlist[4]='(num,'
        val = int(wordlist[4][1:-1])+2
        
        wordlist[4]=''.join([wordlist[4][1:1],str(val),wordlist[4][-2:1]])
        f_write.write(' '.join(wordlist))
        print(wordlist)
